package com.mo.xi.ge.info.help

import android.content.Context
import android.os.Build
import androidx.core.content.PermissionChecker

/**
 * date:2024/1/29
 **/
internal data class DalaData(var dataToken: String, val requestId: String)


internal fun Context.checkAppPermission(permission: String): Boolean {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) return true
    return PermissionChecker.checkSelfPermission(
        this,
        permission
    ) == PermissionChecker.PERMISSION_GRANTED
}

internal inline fun <D> infoTryCatch(normal: D, block: () -> D): D {
    return try {
        block.invoke()
    } catch (e: Exception) {
        normal
    }
}
